<?php
$pageTitle = '网站配置';
include 'header.tpl.php';
?>

<fieldset>
<legend>更新配置</legend>
	<form action="<?php echo $short_router;?>update" method="post">
		<ul>
		<?php foreach ($configs as $config):?>
			<li>
				<label><?php echo $config['label'];?></label>
				<input type="hidden" name="name[]" value="<?php echo $config['name'];?>" />
				<span>
				<?php if ($config['type']=='text'):?>
					<input type="text" name="value[]" value="<?php echo $config['value'];?>" />
				<?php else :?>
					<textarea rows="3" cols="60" class="kindEditor" id="<?php echo $config['name'];?>" name="value[]"><?php echo $config['value'];?></textarea>
				<?php endif;?>
				</span>
				<span>
				<select name="type[]">
				<option value="text" <?php if ($config['type']=='text'):?>selected="selected"<?php endif;?>>单行文本</option>
				<option value="area" <?php if ($config['type']=='area'):?>selected="selected"<?php endif;?>>多行文本</option>
				</select></span>
				<span>标签值：&lt;?php echo $config['<?php echo $config['name'];?>']; ?&gt;</span>
			</li>
		<?php endforeach;?>
		<li><button type="submit">更新</button></li>
		</ul>
	</form>
</fieldset>
<fieldset>
<legend>添加配置项</legend>
		<form action="<?php echo $short_router;?>add" method="post">
		<ul>
		<li><label>类型</label>
			<select name="type">
			<option value="text">单行文本</option>
			<option value="area">多行文本</option>
			</select>
		</li>
		<li><label>标签</label><input type="text" name="label" /></li>
		<li><label>参数名</label><input type="text" name="name"/></li>
		<li><label>参数值</label><input type="text" name="value" /></li>
		<li><button type="submit">提交</button> <button type="reset">清空</button>
		</li>
		</ul>
		</form>
</fieldset>


<?php
include 'footer.tpl.php';
?>
<script type="text/javascript">
var them = {
	width: '600px',
	height: '150px',
	items: [
	       'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
	       'italic', 'underline', 'strikethrough', 'lineheight', 'image',
	]
};
KindEditor.ready(function(K) {
	$('.kindEditor').each(function(){
		var domID = '#' + $(this).attr('id');
		console.log(domID);
		K.create(domID, them);
	});
});
</script>